﻿@*
    For more information on enabling MVC for empty projects, visit https://go.microsoft.com/fwlink/?LinkID=397860
*@
@{
    Layout = null;
}
<script src="~/lib/layui/layui.js"></script>
<link href="~/lib/layui/css/layui.css" rel="stylesheet" />

<script src="~/lib/jquery/dist/jquery.min.js"></script>
<script src="~/lib/jquery/dist/jquery.js"></script>
<link href="~/lib/layui/css/layui.css" rel="stylesheet" />
<script src="~/lib/layui/layui.js"></script>
<script src="~/js/js.cookie.js"></script>
<script src="~/js/moment.js"></script>
<script src="~/lib/jquery/dist/jquery.js"></script>
<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <title>Demo</title>
    <!-- 请勿在项目正式环境中引用该 layui.css 地址 -->
    <link href="//unpkg.com/layui@2.9.20/dist/css/layui.css" rel="stylesheet">
</head>
<body>
    <div class="layui-form-item">
        <div class="layui-inline">
            <label class="layui-form-label">工序编号</label>
            <div class="layui-input-inline">
                <input type="text" placeholder="请输入" class="layui-input" style="width:200px" id="ProcedureCode" />
            </div>
        </div>
        <div class="layui-inline">
            <label class="layui-form-label">工序名称</label>
            <div class="layui-input-inline">
                <input type="text" placeholder="请输入" class="layui-input" style="width:200px" id="ProcessName">
            </div>
        </div>
        <div class="layui-inline">
            <label class="layui-form-label">是否启用</label>
            <div class="layui-input-inline">
                <input type="text" placeholder="请输入" class="layui-input" style="width:200px" id="isEnable">
            </div>
        </div>
        <div class="layui-inline">
            <div class="layui-input-inline">
                <button type="button" class="layui-btn layui-btn-primary layui-btn-radius" onclick="StashHtml()">查询</button>
                <button type="button" class="layui-btn layui-bg-red layui-btn-radius" lay-on="test-iframe-curt">新增</button>
            </div>
        </div>
     </div>
    <div>
        <table class="layui-hide" id="ID-table-demo-data"></table>
    </div>


  
    <!-- 请勿在项目正式环境中引用该 layui.js 地址 -->
    <script src="//unpkg.com/layui@2.9.20/dist/layui.js"></script>

    <script type="text/html" id="toolDemo">
        <div class="layui-clear-space">
          <a onclick="Update()" lay-on="test-iframe-curs"  style="color:cornflowerblue">编辑</a>
      
        </div>
    </script>

    <script>

        //就绪函数
        $(function () {


            StashHtml()
        
        })

       //仓库显示
        function StashHtml() {


            var ProcedureCode = $("#ProcedureCode").val();
            var ProcessName = $("#ProcessName").val();
            var isEnable = "";
            var gh = $("#isEnable").val();
            if (gh == "")
            {
                isEnable = 0;
            }
            else
            {
                isEnable = $("#isEnable").val();
            }

         
            $.ajax({

                url: '@ViewBag.FoundationRead'+ "/api/Acquire/processhtml",
                data: JSON.stringify({ ProcedureCode: ProcedureCode, ProcessName: ProcessName, isEnable: isEnable }),
                type:"post",
                async:false,
                dataType:"json",
                contentType: "application/json",
                success: res => {
                
                    layui.use('table', function () {
                        var table = layui.table;

                        // 已知数据渲染
                        var inst = table.render({
                            elem: '#ID-table-demo-data',
                            toolbar: '#toolbarDemo',
                            cols: [[ //标题栏     
                                { type: 'checkbox', title: '复选框', fixed: true }, // 单选框
                                { field: 'procedureCode', title: '工序编码', width: 200 },
                                { field: 'processName', title: '工序名称', width: 200 },
                                { field: 'isEnable', title: '是否启用', width: 200 },
                                { field: 'processInstructions', title: '备注', width: 200 },
                                { fixed: 'right', title: '操作', width: 134, minWidth: 125, templet: '#toolDemo' }
                            ]],
                            data: res.data,
                            //skin: 'line', // 表格风格
                            //even: true,
                            page: true, // 是否显示分页
                            limits: [5, 10, 15],
                            limit: 5 // 每页默认显示的数量
                        });
                    });
                }

            })





        }






           var $ = layui.$;
        var table = layui.table
            var layer = layui.layer;
            var util = layui.util;
       

        var getid = 0;

        // 触发表格复选框选择
        table.on('checkbox(ID-table-demo-data)', function (obj) {
          getid=obj.data.processid
        });

      

             // 事件
            util.on('lay-on', {

                'test-iframe-curt': function () {
                    layer.open({
                        type: 2,
                        title: '增加工序',
                        shadeClose: true,
                        maxmin: true, //开启最大化最小化按钮
                        area: ['1200px', '900px'],
                    content: '/Document/ProcessAdds'
                    });
                }
            })

        function Update()
        {

        
            
            var $ = layui.$;
            var table = layui.table
            var layer = layui.layer;
            var util = layui.util;
            // 事件
            util.on('lay-on', {

                'test-iframe-curs': function () {
                    layer.open({
                        type: 2,
                        title: '工序编辑',
                        shadeClose: true,
                        maxmin: true, //开启最大化最小化按钮
                        area: ['900px', '600px'],
                        content: '/Document/Processback?id=' + getid
                    });
                }
            })





        }




       




    </script>
 

  

</body>
</html>











